package day06;

import java.util.Random;

public class GuessNumberGame extends GuessGame{

    @Override
    public String genRandom() {
        int r = 1 + new Random().nextInt(1000);
        return String.valueOf(r);
    }

    @Override
    public void hint() {
        System.out.println("已经产生了一个[0, 1001)范围的随机整数");
        System.out.println("猜猜这个数是几");
    }

    @Override
    public String compareResult(String c, String r) {
        int input = Integer.parseInt(c);
        int result = Integer.parseInt(r);
        if(input > result){
            return "大";
        }else if(input < result){
            return "小";
        }else{
            return "对";
        }
    }

    @Override
    public boolean guessRight(String result) {
        return "对".equals(result);
    }
}
